import type { PropType } from 'vue';

export interface IDialogProps {
  visible: boolean;
  /**
   * 标题
   */
  title?: string;
  /**
   * 辅助文案
   */
  descText?: string;
  /**
   * 底部辅助文案
   */
  footerDescText?: string;
  /**
   * 底部辅助文案图标
   */
  footerDescIcon?: string;
  /**
   * 是否显示取消按钮
   * @default true
   * @type boolean
   */
  showCancelButton?: boolean;
  /**
   * 取消按钮文案
   * @default 取 消
   * @type string
   */
  cancelText?: string;
  /**
   * 确定按钮文案
   * @default 确 定
   * @type string
   */
  confirmText?: string;
  loading?: boolean;
  btnDisabled?: boolean;
  /**
   * 是否显示footer
   * @default true
   * @type
   */
  footer?: boolean;
  // 关闭前是否需要二次确认
  confirmBeforeClose?: boolean;
  /**
   * 关闭前二次确认文案
   * @default 是否确定关闭弹窗？
   * @type string
   */
  confirmBeforeCloseText?: string;
  /**
   * 弹窗的宽度
   * @default 'default'
   * @type 'small' | 'default' | 'large' | 'auto'
   */
  size?: keyof typeof sizeMap;
  /**
   * 固定高度
   */
  fixedHeight?: boolean;
}

export const dialogProps = {
  visible: {
    type: Boolean as PropType<boolean>,
    default: false,
    require: true
  },
  title: {
    type: String as PropType<string>,
    default: ''
  },
  descText: {
    type: String as PropType<string>,
    default: ''
  },
  footerDescText: {
    type: String as PropType<string>,
    default: ''
  },
  footerDescIcon: {
    type: String as PropType<string>,
    default: ''
  },
  showCancelButton: {
    type: Boolean as PropType<boolean>,
    default: true
  },
  cancelText: {
    type: String as PropType<string>,
    default: '取消'
  },
  confirmText: {
    type: String as PropType<string>,
    default: '确定'
  },
  loading: {
    type: Boolean as PropType<boolean>,
    default: false
  },
  btnDisabled: {
    type: Boolean as PropType<boolean>,
    default: false
  },
  footer: {
    type: Boolean as PropType<boolean>,
    default: true
  },
  confirmBeforeClose: {
    type: Boolean as PropType<boolean>,
    default: false
  },
  confirmBeforeCloseText: {
    type: String as PropType<string>,
    default: '是否确定关闭弹窗？'
  },
  size: {
    type: String as PropType<keyof typeof sizeMap>,
    default: 'default'
  },
  fixedHeight: {
    type: Boolean,
    default: false
  },
  contentHeader: {
    type: Number,
    default: 0
  }
};

export const sizeMap = {
  small: '460px',
  default: '680px',
  large: '960px',
  auto: '84%'
};
